//
//  StatusCellBottomView.swift
//  weibo
//
//  Created by 陈伟 on 15/10/19.
//  Copyright © 2015年 陈伟. All rights reserved.
//

import UIKit

class StatusCellBottomView: UIView {

    private var commentButton: UIButton = UIButton(title: "评论", color: UIColor.darkGrayColor(), imageName: "timeline_icon_comment")
    private var retweetButton: UIButton = UIButton(title: "转发", color: UIColor.darkGrayColor(), imageName: "timeline_icon_retweet")
    private var likebutton: UIButton = UIButton(title: "赞", color: UIColor.darkGrayColor(), imageName: "timeline_icon_unlike")
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func v() -> UIView {
        
        let v = UIView()
        v.backgroundColor = UIColor.lightGrayColor()
        return v
    }
    
    //设置UI
    func setupUI() {
 
        backgroundColor = UIColor.init(white: 0.9, alpha: 1)
        addSubview(commentButton)
        addSubview(retweetButton)
        addSubview(likebutton)
        
        //分割线
        let v1 = v()
        let v2 = v()
        addSubview(v1)
        addSubview(v2)
        
        commentButton.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(self.snp_left)
            make.top.equalTo(self.snp_top)
            make.bottom.equalTo(self.snp_bottom)
        }
        
        retweetButton.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(commentButton.snp_right)
            make.top.equalTo(commentButton.snp_top)
            make.bottom.equalTo(commentButton.snp_bottom)
            make.width.equalTo(commentButton.snp_width)
        }
        
        likebutton.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetButton.snp_right)
            make.top.equalTo(commentButton.snp_top)
            make.bottom.equalTo(commentButton.snp_bottom)
            make.right.equalTo(self.snp_right)
            make.width.equalTo(commentButton.snp_width)
        }
    
        v1.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(commentButton.snp_right)
//            make.top.equalTo(self.snp_top)
            make.centerY.equalTo(self.snp_centerY)
            make.width.equalTo(0.5)
            make.height.equalTo(self.snp_height).multipliedBy(0.6)
        }
        
        v2.snp_makeConstraints { (make) -> Void in
            make.left.equalTo(retweetButton.snp_right)
//            make.top.equalTo(self.snp_top)
            make.centerY.equalTo(self.snp_centerY)
            make.width.equalTo(0.5)
            make.height.equalTo(self.snp_height).multipliedBy(0.6)
        }
        
    }
}
